import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import eslintPlugin from 'vite-plugin-eslint'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    eslintPlugin({
      exclude: ['./node_modules/**'],
      cache: false,
    }),
  ],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'),
      // Components: resolve(__dirname, 'components'),
      // Plugin: resolve(__dirname, 'plugin'),
      // Utils: resolve(__dirname, 'utils'),
      // Request: resolve(__dirname, 'server'),
    },
  },
  server: {
    host: '0.0.0.0',
    proxy: {
      '/sso': {
        target: 'http://172.17.33.119:20400',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/app/, ''),
      },
      '/api': {
        target: 'http://172.17.33.119:20440/',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/app/, ''),
      },
    },
  },
  preview: {
    port: 8080,
    open: true,
  },
})
